package com.agritech.machines;

import com.agritech.factory.AgriculturalMachine;
import com.agritech.observer.EnvironmentData;

/**
 * 播种机类
 */
public class Seeder extends AgriculturalMachine {
    private double seedingDepth;
    private String seedType;

    @Override
    public void startOperation() {
        System.out.println(getName() + " 开始播种作业");
    }

    @Override
    public void stopOperation() {
        System.out.println(getName() + " 停止播种作业");
    }

    @Override
    public void executeTask(String task) {
        System.out.println(getName() + " 执行任务: " + task);
    }

    @Override
    protected void adjustOperationStrategy(EnvironmentData data) {
        if (data.getSoilMoisture() > 80) {
            System.out.println(getName() + " 土壤湿度过高，调整播种深度并暂停作业");
            this.seedingDepth = 5.0; // 调整播种深度
            stopOperation();
        } else {
            System.out.println(getName() + " 环境正常，继续作业");
        }
    }
}